package com.fary.resourceloader;

import org.springframework.core.io.*;

public class TestResourceLoader {

	public static void main(String[] args) {
		ResourceLoader loader = new DefaultResourceLoader();
		Resource resource = loader.getResource("http://www.baidu.com");

		System.out.println(resource instanceof UrlResource); //true
		//注意这里前缀不能使用“classpath*:”，这样不能真正访问到对应的资源，exists()返回false
		resource = loader.getResource("classpath:test.txt");
		System.out.println(resource instanceof ClassPathResource); //true

		resource = loader.getResource("test.txt");
		System.out.println(resource instanceof ClassPathResource); //true
	}
}
